package coolingPool

import (
	"gorm.io/plugin/soft_delete"
	"xkginweb/global"
	"xkginweb/model/entity/coolingPoolDevice"
)

// 冷池表

type QccCoolingPool struct {
	CoolingPoolId   uint                                          `gorm:"primarykey;comment:主键ID" json:"cooling_pool_id"` // 主键ID
	CreatedAt       global.LocalTime                              `gorm:"type:datetime(0);autoCreateTime;comment:创建时间" json:"created_at"`
	UpdatedAt       global.LocalTime                              `gorm:"type:datetime(0);autoUpdateTime;comment:更新时间" json:"updated_at"`
	IsDeleted       soft_delete.DeletedAt                         `gorm:"softDelete:flag,DeletedAtField:DeletedAt;default:0" json:"isDeleted" structs:"is_deleted"`
	CoolingPoolName string                                        `gorm:"type:varchar(50);comment:冷池名;NOT NULL;default:''" json:"cooling_pool_name"`
	RoomId          uint                                          `gorm:"type:bigint(20);comment:房间id;NOT NULL" json:"room_id"`
	QccRoom         *QccRoom                                      `gorm:"foreignKey:RoomId;references:room_id;" json:"room"`
	Children        []*coolingPoolDevice.QccCoolingPoolDeviceList `gorm:"-" json:"children"`
	Type            string                                        `json:"type" gorm:"not null;default:'';comment:检查类型"`
}

type QccCoolingPoolList struct {
	CoolingPoolId   uint   `gorm:"primarykey;comment:主键ID" json:"cooling_pool_id"` // 主键ID
	CoolingPoolName string `gorm:"type:varchar(50);comment:冷池名;NOT NULL;default:''" json:"cooling_pool_name"`
	RoomId          uint   `gorm:"type:bigint(20);comment:房间id;NOT NULL" json:"room_id"`
	// 忽略该字段，- 表示无读写，-:migration 表示无迁移权限，-:all 表示无读写迁移权限
	Children []*coolingPoolDevice.QccCoolingPoolDeviceList `gorm:"-" json:"children"`
}

func (QccCoolingPool) TableName() string {
	return "qcc_cooling_pool"
}

type QccRoom struct {
	RoomId   uint   `json:"room_id" gorm:"primarykey;comment:主键ID"` // 主键ID
	RoomName string `json:"room_name" gorm:"not null;default:'';comment:房间名"`
	RoomType int8   `json:"room_type" gorm:"not null;default:0;comment:房间类型 1进线房 2机房"`
}
